#include "multichat.h"
#include "ui_multichat.h"
#include "singlemultichat.h"

MultiChat::MultiChat(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MultiChat),
    chat_client(ChatClient::getChatClientInstance())
{
    ui->setupUi(this);
}

MultiChat::~MultiChat()
{
    delete ui;
}

void MultiChat::on_multi_join_clicked()
{
    QString multi_ip = ui->multi_ip->text();
    SingleMultiChat *s_multi = new SingleMultiChat(0 ,multi_ip);
    s_multi->show();
    //s_multi->showSync();
    chat_client.sendJoinMultiSlots(multi_ip.toStdString());
}

void MultiChat::on_multi_leave_clicked()
{
    QString multi_ip = ui->multi_ip->text();
    SingleMultiChat *s_multi = new SingleMultiChat(0 ,multi_ip);
    s_multi->show();
    chat_client.sendLeaveMultiSlots(multi_ip.toStdString());
}
